/*
 * @Description:
 * @Version:
 * @Autor: tangwc
 * @Date: 2022-10-06 12:01:30
 * @LastEditors: tangwc
 * @LastEditTime: 2022-12-23 21:07:29
 * @FilePath: \esp32_wifi_link\captive_portal\main\main_app.c
 *
 *  Copyright (c) 2022 by tangwc, All Rights Reserved.
 */
#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "esp_system.h"
#include "esp_log.h"
#include "nvs_flash.h"

#include "task_define.h"


void app_main(void)
{
    // 初始化nvs用于存放wifi或者其他需要掉电保存的东西
	esp_err_t ret = nvs_flash_init();
	if (ret == ESP_ERR_NVS_NO_FREE_PAGES)
	{
		ESP_ERROR_CHECK(nvs_flash_erase());
		ret = nvs_flash_init();
	}
	ESP_ERROR_CHECK(ret);

    create_app_task();

    while (1)
    {
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}
